/**
 * liuzh.js
 * 自己的js插件1.0.0
 */
var liuzh = {
	/**	获取事件目标元素	*/
	getElement : function(event){
		var e = event || window.event,
			target = e.target;
		return target;
	},	
	/**	返回一个背景div	*/
	getBackground : function(){
		var div = document.createElement("div"),
			style = {
				"height":"100%",
				"width":"100%",
				"position" : "fixed",
				"background" : "rgba(0,0,0,.7)",
			    "top": "0",
			    "z-index" : "11"
				};
		$(div).css(style);
		return div;
	},
	/**
	 * 提示
	 */
	msg : function(d){
		var msg = d.msg || "你忘了给提示文字！！",
			width = d.width || 200,
			height = d.height || 40,
			div = liuzh.getBackground(),
			style = {
			"display":"inline-block",
			"width" : width + "px",
			"height" : height + "px",
			"top" : "0",
			"bottom" : "0",
			"left" : "0",
			"right" : "0",
			"color" : "white",
			"opacity" : "0",
			"margin" : "auto",
			"border-radius" : "5px",
			"text-align" : "center",
			"line-height" : height + "px",
			};
		$(div).css(style).text(msg).css("width",function(){
			var textL = $(this).text().length + 2;
			return  textL+"rem";
			
		});
		$("body").append(function(){
			return $(div).animate({"opacity":"1"},500,function(){
				setTimeout(function(){
					$(div).animate({"opacity":"0"},1000,function(){
						$(div).remove();
						if(d.callback){
							d.callback();
						}
					})
				},1000)
			});
		});
	},
	/**	查看大图	*/
	bigImage : function(event){
		var ele = liuzh.getElement(event),
			div = liuzh.getBackground(),
			src = $(ele).attr("src"),
			img = $("<img src='"+src+"'>")
			.css({
				"width":"100%",
				"display":"block",
				"position":"relative",
				"margin":"auto"});
		$(div).append(img).on("click",function(){$(this).remove()})
		.on("touchmove",function(){return false;});
		$("body").append($(div).fadeIn());
	},
	/**	图片懒加载 */
	lazyLoad : function(reg,removeReg) {
		(function(){
		    var special = $.event.special,
		        uid1 = 'D' + (+new Date()),
		        uid2 = 'D' + (+new Date() + 1);
		    special.scrollstop = {
		        latency: 50,
		        setup: function() {
		            var timer,
		                    handler = function(evt) {
		                    var _self = this,
		                        _args = arguments;
		                    if (timer) {
		                        clearTimeout(timer);
		                    }
		                    timer = setTimeout( function(){
		                        timer = null;
		                        evt.type = 'scrollstop';
		                        initLoad(0);
		                    }, special.scrollstop.latency);
		                };
		            $(this).on('scroll', handler).data(uid2, handler);
		        },
		        teardown: function() {
		            $(this).off( 'scroll', $(this).data(uid2) );
		        }
		    };
		})();
		
		var imgReg = reg || "image",
		remReg = removeReg || true,
		getTop = function(ele) {
			return ele.getBoundingClientRect().top;
		}, 
		innerH = window.innerHeight, imageArr = function() {
			var arr = [];
			$("img["+imgReg+"]").each(function(index, item) {
				arr.push(item);
			});
			return arr;
		}(), 
		initLoad = function(index) {
			for (var i = index; i < imageArr.length; i++) {
				var temp = null;
				temp = imageArr.shift();
				if (getTop(temp) < innerH) {
					$(temp).attr("src", $(temp).attr(imgReg))
					.hide().fadeIn(1000);
					if(remReg) $(temp).removeAttr(imgReg);
					initLoad(i);
				} else {
					imageArr.unshift(temp);
					return false;
				}
			}
		}, 
		lazyLoad = function() {
			var temp = null;
			if (imageArr.length < 1) {
				$(window).off("scroll", lazyLoad);
				$(window).unbind( "scrollstop");
				return false;
			}
			temp = imageArr.shift();
			if (getTop(temp) < innerH) {
				$(temp).attr("src", $(temp).attr(imgReg))
				.hide().fadeIn( 1000 );
				if(remReg) $(temp).removeAttr(imgReg);
			} else {
				imageArr.unshift(temp);
			}
		};
		$(window).on("scroll",lazyLoad);
		$(window).bind( "scrollstop", function(event){} );
		initLoad(0);
	},
	/**
	 * 微信点击加载2.0
	 * @date 2016-11-28
	 * @描述 微信端点击加载（防止页面滚动事件干扰）
	 */
	requireDate : function(data){
		var wefn = this,
			data = data || {},
			$this = {
				url : null,			//链接地址
				page : 1,				//初始页码
				data : {},			//ajax请求的参数
				model : null,			//模型的对象、id、class
				container : null,		//容器的对象、id、class
				prompt : null,		//显示提示信息框（没有更多的提示显示容器的对象、id、class）
				callback : null,	//回调函数
				row : 10,	//每页数据条数
				onScroll : null  // 滚动时的回调函数，适用场景：页面上需要多处滚动事件响应时
			},
			/**	初始化方法 	*/
			init = function(){
				$this = $.extend($this,data);//处理接收参数
				doAJAX();
			},
			/**	ajax方法	*/
			doAJAX = function(){
				var url = $this.url,
					  data = $.extend({"ajax" : "ajax" },$.extend($this.data, {page : $this.page}));
				
				$.post(url , data ,function(data){
					var dataJson = JSON.parse(data);
					judgeLoadData(dataJson.data.length);
					manageResulte(dataJson.data);
				});
			},
			/**	判断是否加载完成	*/
			judgeLoadData = function(length){
				if(length == 0){
					 $($this.prompt).html("没有更多数据了")
					 .css("background-color","white");
					 stopImgMore ($this.prompt,$($this.prompt).siblings(".imore"));
					 unClickMore();
				}else if(length < $this.row){
					 $($this.prompt).html("没有更多数据了")
					 .css("background-color","white");
					 stopImgMore ($this.prompt,$($this.prompt).siblings(".imore"));
					 unClickMore();
				}else{
					$($this.prompt).html("点击加载更多").css("background-color","#f9f9f9");
					clickMore();
				}
			},
			/**	处理结果	*/
			manageResulte = function(data){
				$(data).each(function(){
					var d_model = $($this.model).html();
					for (var int = 0; int < this.length; int++) {
						d_model = d_model.replace(eval("/{arg"+int+"}/g"),this[int]);
					}
					$($this.container).append($(d_model).fadeIn(1000));
				});
				if($this.callback){
					$this.callback();
				};
				if($this.onScroll){
					$this.onScroll();
				};
			},
			//停止正在加载动画
			stopImgMore = function(prompt,loadImg){
				var mText = $(prompt).text();
				if(mText.indexOf("加载")<0){
					var css = {"display":"none"};
					$(loadImg).css(css);
				}
			},
			/**	点击加载	*/
			clickMore = function(){
				$($this.prompt).on("click",function(){
					unClickMore();
					$this.page ++ ;
					doAJAX();
				});
			},
			/**	解绑点击加载	*/
			unClickMore = function(){
				$($this.prompt).off("click");
			};
			/**
			 * wechatContent中途需要再次触发并初始化数据
			 * args 为需要初始化（改变）的数据
			 */
			wefn.wechatReset = function(args){
				$($this.prompt).html("点击加载更多").css("background-color","#f9f9f9");
				$this.page = 1;
				$this = $.extend($this,args);
				$($this.container).empty();//在这初始化时清空container内容
				doAJAX();
			};
			init();
	},
	/**
	 * 	浮动导航
	 * @author liuzh
	 * @date 2016-12-1	
	 * */
	floatNavigation : function(data){
		var fn = this,
			data = data || {},
			param = {
				navigation : ".float-nav-container",//浮动导航对象
				tip : ".float-nav-tip",//提示按钮
				tipStatus : false, //tip提示按钮的状态默认没有点击false
				tipHeight : data.tipHeight || "50px",//浮动导航的高度
				tipWidth : data.tipWidth || "50px",//浮动导航的宽度
				tipTop : data.tipTop || null,//浮动导航的top
				tipRight : data.tipRight || "10px",//浮动导航的right
				tipBottom : data.tipBottom || "100px",//浮动导航的bottom
				tipLeft : data.tipLeft || null,//浮动导航的left
				navArr : [],//导航按钮数组
				userURL : data.userURL || [{tip:"一生爱家",url:"http://www.13ij.com"}],//用户的链接
				navOffset : {left:null,top:null},//浮动导航初始位置
				tipOffset : {left:null,top:null},//浮动按鈕初始位置
				touchOffset : {left:null,top:null},//触摸初始位置
				winWidth : window.innerWidth,	//屏幕宽度
				winHeight : window.innerHeight,	//屏幕宽度
				moveIndex : [],//移动的位置数组
				startX : 0,
				startY : 0,
				ticking : false,
				lock : true
			},
			init = function(){
				navArray();
				$("body").append(createContainer());
			},
			/**	获取transform x y 的值 */
			transXY = function(ele){
				/*var ele = $(ele)[0];
				return {"x": ele.lefts || 0 ,"y": ele.tops || 0 };*/
				var str = $(ele).css("transform"),
				re = str.substring(7,str.length-1).split(",").reverse(),
				x = parseInt(re[1]),
				y = parseInt(re[0]);
				return {"x":x,"y":y};
			},
			//生成一个div
			createDiv  = function(){
				 var div = document.createElement("div");
				return div;
			},
			//生成提示按钮
			createTip = function(){
				var div = createDiv(),
					css = {
						"position" : "absolute",
						"top" : param.tipTop ? "0px" : null ,
						"left" : param.tipLeft ? "0px" : null ,
						"right" : param.tipRight ? "0px" : null ,
						"bottom" : param.tipBottom ? "0px" : null ,
						"width" : param.tipHeight,
						"height" : param.tipHeight,
						"border-radius" : "100%",
						"overflow" : "hidden",
						"border" : "none",
						"margin" : "0px",
						"padding" : "0px",
						"text-align" : "center",
						"line-height" : param.tipHeight,
						"color" : "#000",
						"font-size" : "30px",
						"font-weight" : "bold",
						"transform-origin" : "center",
						"transition" : "all .5s",
						"background" : "rgba(255,255,255,0.8)",
						"opacity" : "0.5",
						"-webkit-tap-highlight-color" : "rgba(0,0,0,0)",
						"font-family" : "-webkit-body"
					};
				$(div).css(css).attr("class","float-nav-tip").text("＋");
				clickTip(div);
				return div;
			},
			//生成导航按钮
			createNav = function(index){
				var div = createDiv(),
					css = {
						"position" : "absolute",
						"top" : param.tipTop ? "0px" : null ,
						"left" : param.tipLeft ? "0px" : null ,
						"right" : param.tipRight ? "0px" : null ,
						"bottom" : param.tipBottom ? "0px" : null ,
						"width" : param.tipWidth,
						"height" : param.tipHeight,
						"overflow" : "hidden",
						"border" : "none",
						"margin" : "0px",
						"padding" : "0px",
						"text-align" : "center",
						"line-height" : param.tipHeight,
						"color" : "white",
						"font-size" : "12px",
						"transform-origin" : "center",
						"transition" : "all .5s",
						"background" : "rgba(0,0,0,0.3)",
						"-webkit-tap-highlight-color" : "rgba(0,0,0,0)",
						"margin" : null
					};
				if(param.tipRight){
					css.right = index * parseInt(param.tipWidth) + index +"px";
				};
				if(param.tipLeft){
					css.left = index * parseInt(param.tipWidth) + index +"px";
				};
				$(div).css(css).text(param.userURL[index-1].tip)
				.on("click",function(){location.href=param.userURL[index-1].url});
				return div;
			},
			//导航按钮array
			navArray = function(){
				for(var i = 1; i<=param.userURL.length ; i++){
					param.navArr.push(createNav(i));
				};
			},
			//生成float容器
			createContainer = function(){
				var div = createDiv(),
					css = {
						"position" : "fixed",
						"z-index" : "99",
						"top" : param.tipTop,
						"left" : param.tipLeft,
						"right" : param.tipRight,
						"bottom" : param.tipBottom,
						"width" : param.tipHeight,
						"height" : param.tipHeight,
						"border-radius" : param.tipHeight,
						"overflow" : "hidden",
						"border" : "none",
						"margin" : "0px",
						"padding" : "0px",
						"text-align" : "center",
						"line-height" : param.tipHeight,
						"color" : "white",
						"transform-origin" : "center",
						"transition" : "all .5s",
						"background" : "rgba(0,0,0,0.3)",
						"-webkit-tap-highlight-color" : "rgba(0,0,0,0)",
						"box-shadow" : "#CCC 1px 1px 10px"
					};
				$(div).css(css).attr("class","float-nav-container").attr("id","float").append(createTip());
				for (var i = param.navArr.length ; i>=0 ; i--) {
					$(div).append(param.navArr[i]);
				};
				bindMove(div);
				return div;
			},
			//导航移动事件
			bindMove = function(ele){
				var onTouch = function(event){
					var event = event || window.event;  
			        switch(event.type){  
			            case "touchstart":  
			                fingerStart(event);
			                break;  
			            case "touchend":  
							fingerEnd(event);
			                break;  
			            case "touchmove":  
			                event.preventDefault();  
			                fingerMove(event);
			                break;
			        }
				},
				fingerStart = function(event){
					var touchs = event.touches[0];
					
					param.touchOffset.left  = touchs.clientX;
					param.touchOffset.top  = touchs.clientY;
					
					param.startX = parseInt(touchs.pageX - (transXY(ele).x || 0));
					param.startY = parseInt(touchs.pageY - (transXY(ele).y || 0));
					
					$(param.navigation).css({"transition":"none"});
					
				},
				fingerMove = function(event){
					var e = event || window.event,
					draw = function() {
						param.ticking = false;
						var nowLeft = parseInt(ele.lefts); //滑动的距离             touchmove时候，如果加阻力，可能有细小的抖动；我想应该是移动端 部分支持0.5px的缘故； parseInt的转化有点牵强；
						var nowTop = parseInt(ele.tops); //滑动的距离    
						ele.style.webkitTransform = ele.style.transform = "translate3d(" + nowLeft + "px," + nowTop + "px,0px)";
					};
					if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
					e.preventDefault();

					if(!param.ticking) {
						var touchs = e.changedTouches[0];
						//1先触摸移动  
						ele.lefts = touchs.pageX - param.startX;
						ele.tops = touchs.pageY - param.startY;
						//动作放入栈中
						requestAnimationFrame(draw);

					}
					param.ticking = true;
				},
				fingerEnd = function(){
					$(param.navigation).css({"transition":"all .5s"});
					$.extend(param.navOffset,$(param.navigation)[0].getBoundingClientRect(),transXY(param.navigation));
					
					//最后一个动作放入栈中
					requestAnimationFrame(moveEndNav);
				},
				doBind = function(){
					$(ele).on('touchstart',onTouch);  
				    $(ele).on('touchmove',onTouch);  
				    $(ele).on('touchend',onTouch);
				}();
			},
			//移动浮动框结束
			moveEndNav = function(){
				var position = param.navOffset,
					x = position.x,
					y = position.y;
			
				if(position.left < 0){
					x = x - position.left;
				}
				if(position.right > param.winWidth){
					x = x - position.right + param.winWidth;
				}
				if(position.top < 0){
					y = y - position.top;
				}
				if(position.bottom > param.winHeight){
					y = y - position.bottom + param.winHeight ;
				}
				$(param.navigation).css({"transform":"translate(" + x + "px," + y + "px)"});
			},
			//提示按钮点击事件
			clickTip = function(ele){
				$(ele).click(function(){
					if(!param.tipStatus){
						param.tipStatus = !param.tipStatus;
						$(this).css({"transform":"rotate(45deg)"});
						param.tipOffset = this.getBoundingClientRect();
					}else{
						param.tipStatus = !param.tipStatus;
						$(this).css({"transform":"rotate(0deg)"});
					};
					navStretch(param.tipStatus);
				});
			},
			//导航按钮伸缩
			navStretch = function(status){
				var stretch = {
						"width":(param.navArr.length+1)*parseInt(param.tipWidth) + 
						param.userURL.length + parseInt(param.tipHeight)/2 + "px"
						},
					noStretch = {
						"width" : param.tipHeight,
						"left" : function(){
									return param.tipOffset.left;
								}()
						};
				if(param.tipRight && param.tipRight != null && param.tipOffset.right - parseInt(stretch.width) <= 0 && status){
					var right = parseInt(param.tipRight) + param.tipOffset.right - parseInt(stretch.width);
					$(param.navigation).css( {"width" : stretch.width,"right": right + "px"} );
				}
				else if(param.tipRight && param.tipRight != null){
					$(param.navigation).css( {"width" : status ? stretch.width : noStretch.width,"right": param.tipRight } );
				}
				if(param.tipLeft && param.tipLeft != null && param.winWidth - param.tipOffset.left < parseInt(stretch.width) && status){
					var left = parseInt(param.tipLeft) -  param.tipOffset.left - parseInt(stretch.width) + param.winWidth ;
					$(param.navigation).css( {"width" : stretch.width,"left": left + "px"} );
				}
				else if(param.tipLeft && param.tipLeft != null){
					$(param.navigation).css( {"width" : status ? stretch.width : noStretch.width,"left": param.tipLeft } );
				}
			};
			
		init();
	},
	/**
	 * 快速获取URL参数
	 * @author liuzh
	 * @date 2017-1-9
	 * @detail ijParam 快速获取URL参数	ijParam.name
	 * */
	lParam : function(a,b,c,d){
			var ijParam = location.search,
		 	ijParam = ijParam.replace('?','').replace(/&/g,'","').replace(/=/g,'":"'),
		 	ijParam = '{"'+ijParam+'"}';
			try{
			 	ijParam = JSON.parse(ijParam);
			}catch(e){
			    ijParam = {};
			}
			window.param = ijParam;
			return ijParam;
	}(function(){
		if($){
			return $;
		}else{
			return window || document || this;
		}
	}()),
	 /**
	  * prompt输入框
	  */
	lPrompt : function(d){
		var p = {
			title : d.title || "title",
			submit : d.submit,
			cancel : d.cancel,
		},
		getdiv = function(){
			 var div = $("<div></div>"),
			 style= {
				 "padding" : "0",
				 "margin" : "0",
				 "width" : "100%",
				 "height" : "100%",
			 };
			 return $(div).css(style);
		 },
		 //背景
		background = function(){
			var div = getdiv(),
				style= {
					"padding" : "0",
					"margin" : "0",
					"width" : "100%",
					"height" : "100%",
					"position" : "fixed",
					"z-index" : "11",
					"top" : "0",
					"background" : "rgba(0,0,0,.3)"
 				};
			return $(div).attr("class","prompt-background").css(style);
		},
		//标题
		title = function(){
			var div = getdiv(),
			style = {
				"width" : "100%",
				"height" : "30px",
				"background" : "rgba(228,228,228,1)",
				"text-align" : "center",
				"line-height" : "30px"
				
			};
			$(div).css(style).attr("class","prompt-title").text(p.title);
			return div;
		},
		//用户填写内容框
		content = function(){
			var div = getdiv(),
				style = {
					"width" : "100%",
					"height" : "200px",
					"padding" : ".5rem",
					"background" : "rgba(255,255,255,1)",
				},
				textArea = $("<textarea></textarea>"),
				textAreaStyle = {
					"width" : "100%",
					"height" : "100%",
					"border" : "0",
					"outline" : "none",
				};
			$(div).attr("class","prompt-content").css(style)
			.append(
					$(textArea).attr("class","prompt-textarea").css(textAreaStyle)
			);
			return div;
		},
		//底部button
		button = function(){
			var div = getdiv(),
			style = {
				"width" : "100%",
				"height" : "30px",
				"background" : "rgba(250,250,250,1)",
				"text-align" : "center",
				"line-height" : "30px",
				"position" : "relative"
				
			},
			button1 = getdiv(),
			button2 = getdiv(),
			buttonStyle = {
				"width" : "50%",
				"height" : "30px",
				"background" : "rgba(228,228,228,1)",
				"text-align" : "center",
				"line-height" : "30px",
				"border-radius" : "5px",
				"float" : "left",
				"-webkit-tap-highlight-color" : "rgba(200,200,200,1)"
			}
		
			$(div).css(style).attr("class","prompt-button")
			.append(
					$(button1).attr("class","prompt-cancel").css(buttonStyle).text("取消")
					.on({
						"touchstart":function(){$(this).css({"background" : "rgba(200,200,200,1)"})} ,
						"touchend":function(){$(this).css({"background" : "rgba(228,228,228,1)"})},
						"click" : function(){
							var content = $(".prompt-textarea").val();
							if(p.cancel){
								p.cancel(content);
							}
							$(".prompt-background").remove()
							
						}
					})
					)
			.append(
					$(button2).attr("class","prompt-submit").css(buttonStyle).text("提交")
					.on({
						"touchstart":function(){$(this).css({"background" : "rgba(200,200,200,1)"})} ,
						"touchend":function(){$(this).css({"background" : "rgba(228,228,228,1)"})},
						"click" : function(){
							var content = $(".prompt-textarea").val();
							/**
							 * do ...
							 */
							if(p.submit){
								p.submit(content);
							}
							$(".prompt-background").remove()
						}
					})
					
					);
			return div;
		},
		//内容框
		container = function(){
			var div = getdiv(),
				style = {
					"width" : "320px",
					"height" : "auto",
					"padding" : ".5rem",
					"margin" : "50% auto",
					"border-radius" : "5px",
					"background" : "rgba(255,255,255,.8)",
				};
			$(div).attr("class","prompt-container").css(style)
			.append(title())
			.append(content())
			.append(button());
			return $(background()).append(div).on("click",function(e){
				var target = e.target;
				if($(target).attr("class") == "prompt-background"){
					$(this).remove();
				}
			}); 
		},
		startPrompt = function(){
			$("body").append(container());
		}();
		 		
	 },
	 /**
	  * 移动元素（兼容手机和pc h5）v2.0
	  * @author liuzh
	  * @怎么使用： enableMove({ele: [产生移动事件的对象,...]，move：[移动的对象,...]});
	  */
	 enableMove : function(d){
	 	if(!d.ele){
	 		console.log("没有绑定元素：error by enableMove");
	 		return false; 
	 	};
	 	var p = {
	 		ele : d.ele,
	 		move : d.move || d.ele,
	 		lock : false,
	 		fingerStart : {left:0,top:0},
	 	},
	 	/**	获取transform x y 的值 */
	 	transXY = function(ele){
	 		/*var ele = $(ele)[0];
	 		return {"x": ele.lefts || 0 ,"y": ele.tops || 0 };*/
	 		var str = $(ele).css("transform"),
	 		re = str.substring(7,str.length-1).split(",").reverse(),
	 		x = parseInt(re[1]),
	 		y = parseInt(re[0]);
	 		return {"x":x,"y":y};
	 	},
	 	browser = {
	        versions: function() {
	            var u = navigator.userAgent, app = navigator.appVersion;
	            return {     //移动终端浏览器版本信息
	                trident: u.indexOf('Trident') > -1, //IE内核
	                presto: u.indexOf('Presto') > -1, //opera内核
	                webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
	                gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
	                mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
	                ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
	                android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或uc浏览器
	                iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
	                iPad: u.indexOf('iPad') > -1, //是否iPad
	                webApp: u.indexOf('Safari') == -1 //是否web应该程序，没有头部与底部
	            };
	        } (),
	        language: (navigator.browserLanguage || navigator.language).toLowerCase()
	    },
	 	touchStart = function(event){
	 		var touchs = event.touches[0];
	 		
	 		p.fingerStart.left = parseInt(touchs.pageX - (transXY(p.move).x || 0));
	 		p.fingerStart.top = parseInt(touchs.pageY - (transXY(p.move).y || 0));
	 		
	 	},
	 	touchMove = function(event){
	 		var e = event || window.event,
	 		draw = function() {
	 			p.lock = false;
	 			var nowLeft = parseInt(p.move.lefts); //滑动的距离          
	 			var nowTop = parseInt(p.move.tops); //滑动的距离    
	 			$(p.move).css({"transform":"translate3d(" + nowLeft + "px," + nowTop + "px,0px)"});
	 		};
	 		if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
	 		e.preventDefault();
	 		
	 		if(!p.lock) {
	 			var touchs = e.changedTouches[0];
	 			//1先触摸移动  
	 			p.move.lefts = touchs.pageX - p.fingerStart.left;
	 			p.move.tops = touchs.pageY - p.fingerStart.top;
	 			//动作放入栈中
	 			requestAnimationFrame(draw);
	 		}
	 		
	 		p.lock = true;
	 	},
	 	touchEnd = function(event){
	 		
	 	},
	 	mouseDown = function(event){
	 		$(p.ele).each(function(){
	 			$(this).css({"cursor" : "-webkit-grabbing"});
	 		});
	 		p.fingerStart.left = parseInt(event.pageX - (transXY(p.move).x || 0));
	 		p.fingerStart.top = parseInt(event.pageY - (transXY(p.move).y || 0));
	 		
	 		$(window).on("mousemove",mouseMove);
	 	},
	 	mouseMove = function(event){
	 		var e = event || window.event;
	 		
	 		p.move.lefts = e.pageX - p.fingerStart.left;
	 		p.move.tops = e.pageY - p.fingerStart.top;
	 		
	 		$(p.move).css({"transform":"translate3d(" + parseInt(p.move.lefts) + "px," + parseInt(p.move.tops) + "px,0px)"});
	 		
	 	},
	 	mouseUp = function(){
	 		$(p.ele).each(function(){
	 			$(this).css({"cursor" : "-webkit-grab"});
	 		});
	 		$(window).off("mousemove",mouseMove);
	 	},
	 	//绑定触摸事件
	 	bindEvent = function(){
	 		if(browser.versions.mobile){
	 			$(p.ele).each(function(){
	 				$(this).on({
	 					"touchstart" : touchStart,	
	 					"touchmove" : touchMove,	
	 					"touchend" : touchEnd
	 				});
	 			});
	 		}else{
	 			$(p.ele).each(function(){
	 				$(this).on({
	 					"mousedown" : mouseDown	
	 				}).css({"cursor" : "-webkit-grab","user-select": "none"});
	 			});
	 			$(window).on({
	 				"mouseup" : mouseUp,
	 			});
	 		}
	 		
	 	}();
	 },
	 /** 元素点击抖动 */
	 shakeElement : function(ele){
		 var ele = ele,
		 left = {"transform":"translate3D(-5px,0px,0px)"},
		 right = {"transform":"translate3D(5px,0px,0px)"},
		 origin = {"transform":"translate3D(0px,0px,0px)"},
		 flag = true,
		 count = 20,
		 shake = function(){
			 if(flag){
				 flag = !flag;
				 $(ele).css(left);
			 }else{
				 flag = !flag;
				 $(ele).css(right);
			 };
			 if(count > 0){
				 count --;
				 setTimeout(shake,30);
			 }else{
				 $(ele).css(origin);
				 return false;
			 };
		 };
		 shake();
	 }
	 

}
$.extend(liuzh);


